import java.util.Arrays;

public class StringDemo03 {
    public static void main(String[] args) {
        String s = "答应我";
        System.out.println(s.charAt(0));// 根据索引返回字符
        System.out.println(s.contains("我"));//true
        System.out.println(s.endsWith("我"));// true
        System.out.println(s.startsWith("答"));// true
        System.out.println(s.equals("答应我"));// true

        String s1 = "a0A";
        System.out.println(s1.getBytes());
        System.out.println(Arrays.toString(s1.getBytes()));

        String s2 = "永不放弃,放弃可耻";
        System.out.println(s2.indexOf("放弃"));
        System.out.println(s2.lastIndexOf("放弃"));//5

        String s3 = "";
        System.out.println(s3.isEmpty());//true
        System.out.println(s1.length());
    }
}
